package com.ssm.utils;

import org.springframework.beans.propertyeditors.PropertiesEditor;
import org.springframework.lang.Nullable;

import java.text.ParseException;
import java.util.Date;

/**
 * 日期与字符串转换
 */
public class DateStringEditor extends PropertiesEditor {

    public void setText(@Nullable String text) throws IllegalArgumentException, ParseException {
        Date date = DateUtils.string2Date(text, "yyyy-MM-dd HH:mm");
        super.setValue(date);
    }
}
